avatar Bite 160. 15-way Rock Paper Scissors

In this Bite you are going to write a 15-way Rock Paper Scissors game (this challenge first appeared as part of our 100 Days of Code in Python course).

picture of who beats who in this 15-way version of rock paper scissors


(source: http://www.umop.com/rps15.htm)

The way you read this graphic is if an arrow points from one item to another, that pointed-to item is defeated. For example:

  • Paper defeats rock (paper points to rock)
  • Devil defeats human (devil points to human)

It turns out to be error prone and generally very unfun to work this out from the graphic. So we created a csv score sheet representing these relationships.

Complete the get_winner function following the docstring. We recommend parsing it into a dictionary/mapping of players -> beats whom (key, value) pairs (helper function _create_defeat_mapping). This will make it easier to determine the winner given any pair of (player1, player2) pairs.

The tests (see TESTS tab) will verify valid input to get_winner, all Tie scenarios and (more interestingly) all 105 outcomes using the original RPS-15 speak.

Good luck and have fun!

Login and get coding
go back Advanced level
Bitecoin 4X

Will you be the 140th person to crack this Bite?
Resolution time: ~56 min. (avg. submissions of 5-240 min.)
Our community rates this Bite 4.38 on a 1-10 difficulty scale.
» Up for a challenge? 💪

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help